//#difyr
//Pticin G.A.
//2103/1



#include <stdio.h>


FILE *outf;      
   int I,J,N,M,L,O,m,k;
   double Q[6][6],B[6],X[6];

main()
{ 
   
   outf = stdout;     

   fprintf(outf, "MATRIZA\n");              
   fprintf(outf, "Pticin G.A.\n");
   fprintf(outf, "gryppa 2103/1\n");
   fprintf(outf, "\n");
   fprintf(outf, "\n"); 
    N=4;
    M=N;
    O=N;
     
    for( m=1; m<=N; m++)   
    { 
       for(k=1;k<=M;k++)
       {
          if (m!=k) Q[m][k]=1;
          if (m==k) Q[m][k]=0;       
       }
    }
    Q[1][1]=2;
    Q[2][2]=4;
    Q[3][3]=6;
    Q[4][4]=8;
    B[1]=4;
    B[2]=6;
    B[3]=8;
    B[4]=10;
    


          
    
    for(m=1;m<=O-1;m++)
    {
       for(k=m+1;k<=N;k++)
       {
          Q[k][m]=Q[k][m]/Q[m][m];
       }
       B[m]=B[m]/Q[m][m];
       
       for(k=m+1;k<=N;k++)
       {
          for(J=m+1;J<=M;J++)
          {
             Q[J][k]=Q[J][k]-Q[m][k]*Q[J][m];
          }
          B[k]=B[k]-B[m]*Q[m][k];
          Q[m][k]=0;
       }
       Q[m][m]=1;
    } 
           
/*for(m=1;m<=4;m++)
   {
   fprintf(outf,"\n");
   for(k=1;k<=4;k++)
       fprintf(outf, "%f\n",Q[m][k]);
   }
   for(m=1;m<=4;m++)
   {
     fprintf(outf, "%f\n",B[m]); 
   }
 */
    X[N]=B[N]/Q[N][N];

    for(I=N-1;I>=1;I--)
    {
       m=4;
       O=I;
       while((N-O)>0)
       {
          B[I]=B[I]-Q[m][I]*X[m];
          X[I]=B[I];
          m=m-1;
          O=O+1;
       }
    } 
    
    for(m=1;m<=4;m++)
       fprintf(outf, "%1.16f\n",X[m]);
    
    getchar();
  return 0;
}      
    
